package com.control.qct.businesssteward.adapter;

import android.support.annotation.Nullable;

import com.control.qct.businesssteward.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.control.qct.businesssteward.model.GoodsParentTypeModel;

import java.util.List;

/**
 * Created by Administrator on 2017/12/16 0016.
 */

public class GoodsTypeAdapter extends BaseQuickAdapter<GoodsParentTypeModel, BaseViewHolder> {
    private int mPosition;
    public GoodsTypeAdapter(@Nullable List<GoodsParentTypeModel> data) {
        super(R.layout.rv_goods_type_item, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, GoodsParentTypeModel item) {
        holder.setText(R.id.rb_goods_type_name, item.getTitle());
        holder.setChecked(R.id.rb_goods_type_name,mPosition == holder.getAdapterPosition());
    }

    public void setPosition(int position) {
        this.mPosition = position;
        notifyDataSetChanged();
    }
}
